<include file="public:head" />
<div class="mui-content">
	<div class="am-g" style="padding-top: 20px;">
	  <div class="am-u-md-8 am-u-sm-centered">
	   <form action="/?g=m&m=baoming&a=enroll" method="post" class="am-form" id="enroll-form">
		   <fieldset class="am-form-set" style="width: 80%">
		   		<if condition="$type eq company">
					<if condition="$channel eq xy">
						<input type="hidden" name="channel" value="{$channel}"/>
						<textarea  required="required" style="width: 77%" name="reason" maxlength="80"  placeholder="您的需求?" rows="7"></textarea>
						<else/>
						<input name="goods_id"  style="width: 77%" required="required" type="text" id="goods_url" value="{$item.id}" disabled class="baominginput" placeholder="留言的商品ID">
						<input name="goods_price"  style="width: 77%" required="required"  type="text" id="goods_price" value="{$item.title}" disabled class="baominginput" placeholder="留言的商品名称">
						<input type="text" id="goods_quan"  style="width: 77%" name="goods_price" required="required" autocomplete="off" class="baominginput" placeholder="您希望的商品价格">
					</if>

				   <input name="person_name" required="required"  style="width: 77%" id="person_name"  type="text" autocomplete="off" class="baominginput"  maxlength="10" placeholder="您的称呼">
				   <input type="text" type="text" id="person_tel"  style="width: 77%" name="person_tel" required="required" autocomplete="off" class="baominginput" placeholder="联系手机" onblur="upperCase()">
				<else/>
				   <input name="goods_url" required="required"  style="width: 77%" type="text" id="goods_url" autocomplete="off" class="baominginput" placeholder="报名活动商品的淘宝地址">
				   <input name="goods_price" required="required"  style="width: 77%"  type="text" id="goods_price" autocomplete="off" class="baominginput" placeholder="参加活动的最低价格">
				   <input type="text" id="goods_quan" name="goods_quan"  style="width: 77%" required="required" autocomplete="off" class="baominginput" placeholder="参加活动的专享优惠券金额">
				   <input name="person_name" required="required" id="person_name"  style="width: 77%" type="text" autocomplete="off" class="baominginput" placeholder="您的称呼">
				   <input type="text" id="person_tel" name="person_tel"  style="width: 77%" required="required" autocomplete="off" class="baominginput" placeholder="联系手机" onblur="upperCase()">
				   <textarea  id="reason" name="reason" autocomplete="off"  style="width: 77%" placeholder="您还可以在这里从客观的角度评价您的商品优势，将有助于报名审核通过。" cols="30" rows="6"> </textarea>
		   		</if>
			   <input type="text" name="code" required="required" placeholder="请输入验证码" style="width:200px">
			   <img src="{:U('baoming/verify_code',array('type'=>'baoming'))}" id="v_code" onclick="changeCode()" style="position:relative; top:-63px; left:5px;width: 73px;margin:10px 220px" />
		   </fieldset>

		   <input type="hidden" name="from" value="{$_SERVER['HTTP_REFERER']}"/>
	      <input type="hidden" name="type" value="{$type}"/>
	      <button type="submit" id="smt" class="am-btn am-btn-primary am-btn-block">提交</button>
	    </form>
	  </div>
	</div>
</div>
<script type="text/javascript" src="__STATIC__/mobile/assets/js/base.js"> </script>
<yh:load type="js" href="__STATIC__/tqkwap/layer/layer.js" />
<script>
    function changeCode() {
        var URL = "{:U('baoming/verify_code', array('type'=>'baoming'), '')}"
        $("#v_code").attr(
            "src", URL
        );

    }
	$('#enroll-form').submit(function(){
		$.post($(this).attr('action'), $(this).serialize(), function(json){
			if(json.status != 1){
                changeCode()
                layer.msg(json.msg, {
					icon: 2
				});
				return false;
			}
			layer.msg(json.msg, {
				icon: 1
			}, function(){
				var index = parent.layer.getFrameIndex(window.name);
				parent.layer.close(index);
                location.href='{$_SERVER['HTTP_REFERER']}';
            });
        }, 'json');
		return false;
	});
    function upperCase()

    {

        var phone = document.getElementById('person_tel').value;

        if(!(/^1[23456789]\d{9}$/.test(phone))){

            alert("手机号码有误，请重填");
            $('#person_tel').val("");
            return false;

        }

    }
</script>
<include file="public:foot" />
<script type="text/javascript">
	//侧滑容器父节点
	var offCanvasWrapper = mui('#offCanvasWrapper');
	 //主界面容器
	var offCanvasInner = offCanvasWrapper[0].querySelector('.mui-inner-wrap');
	 //菜单容器
	var offCanvasSide = document.getElementById("offCanvasSide");
	 //侧滑容器的class列表，增加.mui-slide-in即可实现菜单移动、主界面不动的效果；
	var classList = offCanvasWrapper[0].classList;
	classList.add('mui-slide-in');
	offCanvasWrapper.offCanvas().refresh();
	 //主界面和侧滑菜单界面均支持区域滚动；
	mui('#offCanvasSideScroll').scroll();
	mui('#offCanvasContentScroll').scroll();
	offCanvasInner.addEventListener('drag', function(event) {
	    event.stopPropagation();
	});
</script>